<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Document</title>
  </head>
  <body>
    <script>
 	    var year = prompt('请输入您的年龄');
 	    var age = 2020 - parseInt(year);	// 由于year是字符串，需要进行转换
    	alert('您今年已经' + age + '岁了');
    </script>
  </body>
</html>